<template>
	<view class="">
		<view class="news_list" v-if="newsList.length != 0">
			<view class="news_item" v-for="(item,index) in newsList" :key="index">
				<view class="news_item_title">
					{{item.title}}
				</view>
				<view class="news_item_con">
					{{item.content}}
				</view>
			</view>
		</view>
		<view class="text" v-else>
			暂无消息~
		</view>
		<view-tabbar selected="1"></view-tabbar>
	</view>
</template>

<script>
	const app = getApp()
	export default {
		data() {
			return {
				newsList: [],
			}
		},
		onLoad() {

		},
		onShow() {
			this.getNewsList()
		},
		methods: {
			// 获取消息列表
			getNewsList() {
				app.getData('/addons/shopro/message', {}).then(res => {
					console.log('====', res)
					this.newsList = res.data.data.data
				})
			}
		}
	}
</script>

<style>
	page {
		background: #F7F7F7;
	}

	.text {
		text-align: center;
		margin-top: 100rpx;
	}

	.news_list {
		margin: 32rpx;
	}

	.news_item {
		background: #fff;
		border-radius: 10rpx;
		padding: 20rpx 32rpx;
		color: #777;
		margin-bottom: 24rpx;
	}

	.news_item_title {
		font-size: 30rpx;
		color: #000;
		font-weight: 600;
		margin-bottom: 20rpx;
	}

	.news_item_con {
		line-height: 46rpx;
	}
</style>
